#include <bits/stdc++.h>
using namespace std;

int n=0;    //n个节点
int m=0;    //m个边

struct edge{    //城市之间的路径
    int from,to;
    double w;   //距离，消耗值
};

vector<edge>e[maxn];  //将所有路径信息存起来

double dis[maxn];
bool done[maxn];

struct node{          //在open表中使用的结构体，方便判断当前最优值
    int id;
    double s;
    bool operator<(const node&a)const{
        return s>a.s;
    }
};

void print_path(int last){      //递归打印路径
    if(pre[last]==-1){
        cout<<last;
        return;
    }
    print_path(pre[last]);
    cout<<"-"<<last;
}

void dijkstra(int start,int last){
    priority_queue<node>Q;
    dis[start]=0.0;
    Q.push(node{start,dis[start]});
    while(!Q.empty()){
        node tmp=Q.top();
        Q.pop();
        if(done[tmp.id]){
            if(tmp.id==last) break;
            continue;
        }
        done[tmp.id]=true;
        for(int i=0;i<e[tmp.id].size();i++){
            edge t=e[tmp.id][i];
            if(done[t.to]) continue;
            if(dis[t.to]>t.w+tmp.s){
                dis[t.to]=t.w+tmp.s;
                Q.push(node{t.to,dis[t.to]});
                pre[t.to]=tmp.id;
            }
        }
    }
    cout<<dis[last]<<endl;
    print_path(last);
}

int main()
{   //数据处理
    while(cin>>id>>x>>y){
        L[id].x=x;
        L[id].y=y;
        n++;
    }
    init();
    while(cin>>u>>v){
        w=sqrt(pow((L[u].x-L[v].x),2)+pow((L[u].y-L[v].y),2));
        e[u].push_back(edge{u,v,w});
        e[v].push_back(edge{v,u,w});
        m++;
    }
    int start,last;
    cin>>start>>last;
    dijkstra(start,last);
    return 0;
}